<table class="table table-bordered table-striped table-hover">
    <tr>
        <td style="text-align: left; width: 300px;">
            <?php echo $this->t('Thời gian tạo')?> <i><?php echo $model->createdTime?></i>
        </td>
        <?php if($this->manager):?>
            <td style="text-align: right;">1k = 1000 VNĐ</td>
        <?php endif?>
    </tr>
</table>

<table class="table table-bordered table-striped table-hover">
    <tr>
        <th><?php echo $this->t('Tên khách hàng')?></th>
        <th><?php echo $this->t('Số điện thoại')?></th>
        <th><?php echo $this->t('Địa chỉ')?></th>
        <th><?php echo $this->t('Điểm tích lũy')?></th>
    </tr>
    <tr>
        <td><?php echo ($model->customer_id == 1) ? $model->customer_guest_name : $model->customer->name?></td>
        <td><?php echo ($model->customer_id == 1) ? $this->t('Không sử dụng') : $model->customer->phone?></td>
        <td>
        <?php if($model->customer_guest_address || ($model->customer->id != 1 && $model->customer->address)):?>
            <?php echo ($model->customer_id == 1) ? $model->customer_guest_address : $model->customer->address?>
        <?php endif?>
        </td>
        <td><?php echo $model->customer->point?>k</td>
    </tr>
</table>


<table class="table table-bordered table-striped table-hover">
    <tr>
        <th colspan="2" style="text-align: center;">
            <?php echo $this->t('Đơn hàng')?> 
            <?php echo ($model->type == "PACKAGE") ? $this->t('Theo lượt') : $this->t('Theo chiếc')?>
        </th>
        <th colspan="4" style="text-align: center;"><?php echo $this->t('Dịch vụ sử dụng')?></th>
    </tr>
    <tr>
        <th style="width: 30px;"><?php echo $this->t('STT')?></th>
        <th style="width: 300px;"><?php echo $this->t('Tên đồ')?></th>
        <?php foreach($info['prices'] as $k => $v):?>
            <th><?php switch($k){
                case 'laundry_price': echo Yii::t('app', $this->t('Giặt ướt')); break;
                case 'dry_price': echo Yii::t('app', $this->t('Sấy khô')); break;
                case 'iron_price': echo Yii::t('app', $this->t('Là hơi')); break;
                case 'laundry_dry_price': echo Yii::t('app', $this->t('Giặt khô')); break;
            }?></th>
            <?php endforeach;?>
    </tr>
    <?php foreach($info['items'] as $index => $item):?>
        <tr>
            <td><?php echo $index+1?></td>
            <td><?php echo $item['name']?></td>
            <?php foreach($info['prices'] as $k => $v):?>
                <td><?php switch($k){
                    case 'laundry_price': 
                        echo !empty($item[$k]) ? $item[$k].'k' : '';
                        break;
                    case 'dry_price': 
                        echo !empty($item[$k]) ? $item[$k].'k' : '';
                        break;
                    case 'iron_price':
                        echo !empty($item[$k]) ? $item[$k].'k' : '';
                        break;
                    case 'laundry_dry_price':
                        echo !empty($item[$k]) ? $item[$k].'k' : ''; 
                        break;
                }?></td>
                <?php endforeach;?>
        </tr>
        <?php endforeach;?>

    <tr>
        <th colspan="2" style="text-align: right;"><?php echo $this->t('Thành tiền')?></th>
        <?php foreach($info['prices'] as $k => $v):?>
            <td><?php echo $v ? $v.'k' : ''?></td>
            <?php endforeach?>
    </tr>
    <tr>
        <th colspan="6" style="text-align: center;"><?php echo $model->statusPayLabel?></th>
    </tr>  
</table>


<?php //if($this->manager):?>
<table class="table table-bordered table-striped table-hover">
    <?php if($model->used_point):?>
        <tr>
            <th><?php echo $this->t('Tổng tiền đơn hàng')?></th>
            <td><?php echo $model->price?>k</td>
        </tr>
        <tr>
            <th><?php echo $this->t('Sử dụng điểm')?></th>
            <td style="padding-left: 3px;">- <?php echo $model->used_point?>k</td>
        </tr>
    <?php endif?>
    <tr>
        <th style="width: 300px;"><?php echo $this->t('Tiền mặt thanh toán')?></th>
        <td><?php echo $model->pay_price?>k</td>
    </tr>

    <tr>
        <th><?php echo $this->t('Điểm thưởng')?></th>
        <td>
            <?php if($model->bonus_point):?>
                <?php echo $model->pay_price - $info['prices']['iron_price']?>k <code>x</code> <?php echo $model->bonus_percent?>% = <?php echo $model->bonus_point?>k
                <?php if($model->isRound) echo '('.$this->t('làm tròn').')'?>
                <?php else:?>
                <?php echo $model->bonus_point?>k 
                <i style="font-size: 12px;"> 
                    <?php if($model->type == 'ITEM'):?>
                        (<?php echo $this->t('Chỉ tặng điểm cho đơn hàng sử dụng dịch vụ Giặt ướt, Sấy Khô')?>) 
                        <?php endif?>
            </i>
            <?php endif?>
        </td>
    </tr>
    <tr>
        <th style="width: 300px;"><?php echo $this->t('Trạng thái đơn hàng')?></th>
        <td><?php echo $model->statusLabel?></td>
    </tr>
    <?php if($model->status == 'COMPLETED'):?>
        <tr>
            <td><?php echo $this->t('Thời gian hoàn thành')?></td>
            <td><i><?php echo $model->completedTime?></i></td>
        </tr>
    <?php endif?>
    <?php /*
        <tr>
        <th><?php echo $this->t('Điểm tích lũy sau đơn hàng')?></th>
        <td><?php echo $model->customer_point_after?>k</td>
        </tr>
    */?>
</table>


<?php //endif?>


<table style="float: left; width: 400px" class="table table-bordered table-striped table-hover">
    <tr>
    <td style="text-align: center; font-size: 22px; padding: 20px 14px;">
    <?php echo $this->t('Tiền mặt thanh toán <u>{money}</u> VNĐ', array('{money}' => $model->payPriceVND))?></td>
    </tr>
</table>


<table class="table table-bordered table-striped table-hover" style="width: 350px; float:right">
    <tr>
        <th style="text-align: center;"><?php echo $this->t('Nhân viên')?></th>
        <?php if($this->action->id == 'viewprint'):?>
        <th style="text-align: center; width: 150px;"><?php echo $this->t('Chữ ký')?></th>
        <?php endif?>
    </tr>
    <tr>
        <td style="text-align: center;">
            <div style="font-size: 16px; margin-top: 10px; height: 25px;"><?php echo $model->manager->name?></div>
        </td>
        <?php if($this->action->id == 'viewprint'):?>
        <td></td>
        <?php endif?>
    </tr>
</table>
